﻿/*-----------------------------------------------------------------------------!
! SupplierKazImpl class                                                        !
!------------------------------------------------------------------------------!
! System   : Inventory Management System                                       !
! Client   : UK based                                                          !
! Date     : April 2011                                                        !
! Copyright: (C) KAWISOFT Inc                                                  !
! Program  : SupplierKazImpl.cs                                                !
! Function : Implementation of SupplierKaz interface                           !
!------------------------------------------------------------------------------!
! Notes:                                                                       !
! Original author: Amit Kumar Mondal                                           !
! Last changed by: Amit Kumar Mondal, May 01 2011                              !
===============================================================================*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Model.Sohaok;
namespace Model.Sadharon
{
    class DatabaseConnection
    {
        private static string connectionString;
        //private string selectionString;
        public static SqlConnection sqlConnect;
            
        private static void ConnectToDatabase() {
            connectionString = GetConnectionString.Instance();
            sqlConnect = new SqlConnection(connectionString);
        }

        public static SqlConnection GetConnection() {
            if (sqlConnect != null)
                return sqlConnect;
            else {
                ConnectToDatabase();
                return sqlConnect;
            }
        
        }
    }
}
